package com.hoolai.qps.bo;

import com.google.protobuf.GeneratedMessage;
import com.hoolai.qps.proto.ReqCmdProto.GetItemNameReqCmdProto;
import com.hoolai.qps.proto.ReqCmdProto.GetUserReqCmdProto;
import com.hoolai.qps.proto.ReqCmdProto.SaveUserReqCmdProto;

public class ReqCmdProtoFactory {

    public GeneratedMessage getReqCmdProtoByCmdId(int cmdId) {
        switch (cmdId) {
        case 1000001:
            GetItemNameReqCmdProto.Builder item = GetItemNameReqCmdProto.newBuilder();
            item.setId(100);
            return item.build();
        case 1000002:
            GetUserReqCmdProto.Builder user = GetUserReqCmdProto.newBuilder();
            return user.build();
        case 1000003:
            SaveUserReqCmdProto.Builder saveUser = SaveUserReqCmdProto.newBuilder();
            saveUser.setName("name");
            return saveUser.build();
        default:
            throw new RuntimeException("without this command id");
        }
    }

}
